<?php
include_once("../class/ulevel_class.php");
include_once("../class/system_class.php");
include_once("../function.php");
session_start();
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/table.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="css/style.css" />
<title>会员注册</title>
  <script src='../js/ssjl_jquery.js'></script>
  <script src="../js/shengshixian/jquery.provincesCity.js" type="text/javascript"></script>
  <script src="../js/shengshixian/provincesdata.js" type="text/javascript"></script>
    <link rel="stylesheet" href="./he/jquery.ui.autocomplete.css">
    <script type="text/javascript" src="./js/jquery.min.js"></script>
    <script type="text/javascript" src="he/jquery.ui.core.js"></script>
    <script type="text/javascript" src="he/jquery.ui.widget.js"></script>
    <script type="text/javascript" src="he/jquery.ui.position.js"></script>
    <script type="text/javascript" src="he/jquery.ui.autocomplete.js"></script>
    <script type="text/javascript">
        $(function(){
            $( "#FatherName" ).autocomplete({
                source: "./search.php",
                minLength: 1,
                autoFocus: true
            });
        });
    </script>
    <script type="text/javascript">
        $(function(){
            $( "#rName" ).autocomplete({
                source: "./search.php",
                minLength: 1,
                autoFocus: true
            });
        });
    </script>
    <script>
	//调用插件
	$(function(){
		$("#test").ProvinceCity();
	});
  </script>
<script language="javascript">
<!--
	$(document).ready(function(){
		

		$("#province").change(function(){
			$("#county").html("<option value='-1'>请选择县区</option>");
			$.ajax({
				type:"get",
				url:"diqu.php?province="+this.value,
				dataType:"text",
				success:function(a){
					$("#city").html(a);
				}
				
			})
		});

		$("#city").change(function(){
			$.ajax({
				type:"get",
				url:"diqu.php?city="+this.value,
				dataType:"text",
				success:function(a){
					$("#county").html(a);
				}
				
			})
		});
	})
// function GetNickName()
// {
// 		var rnd="";
// 		var aaa="";
// 		for(var i=0;i<8;i++)
// 		rnd+=Math.floor(Math.random()*10);
// 		aaa="CN"+rnd;
// 		document.form1.NickName.value=aaa;
// 		document.form1.UserID.value=aaa;
// }
function checknickname(lx)
{
	var iframe = document.getElementById("iframe");
	if(lx==1){
		var user =  document.getElementById("bdName");
		iframe.src= "checknickname.php?lx="+lx+"&nickname="+user.value;
	}else if(lx==2){
		var user =  document.getElementById("rName");
		iframe.src= "checknickname.php?lx="+lx+"&nickname="+user.value;	
	}else if(lx==3){
		var user =  document.getElementById("FatherName");
		iframe.src= "checknickname.php?lx="+lx+"&nickname="+user.value;	
	}else if(lx==4){
		var user =  document.getElementById("UserID");
		iframe.src= "checknickname.php?lx="+lx+"&nickname="+user.value;	
	}
}

function CheckForm(){

   // Lsk=document.form1.Lsk.value;
	bdName=document.form1.bdName.value;
	rName=document.form1.rName.value;
	FatherName=document.form1.FatherName.value;
	UserID=document.form1.UserID.value;
	NickName=document.form1.NickName.value;
	password1=document.form1.password1.value;
	password12=document.form1.password12.value;
	password2=document.form1.password2.value;
	password22=document.form1.password22.value;
	password3=document.form1.password3.value;
	password32=document.form1.password32.value;
	passQuestion=document.form1.passQuestion.value;
	passAnswer=document.form1.passAnswer.value;
	UserCard=document.form1.UserCard.value;
	UserName=document.form1.UserName.value;
//	UserTel=document.form1.UserTel.value;
	UserAddress=document.form1.UserAddress.value;
	BankCard=document.form1.BankCard.value;
	BankUserName=document.form1.BankUserName.value;
	BankAddress=document.form1.BankAddress.value;
	useremail=document.form1.useremail.value;
    ulevel=document.form1.uLevel.value;
	var county=document.getElementById("city");
	var reg=/^\w{1,}$/;
	var reg1 = /^([A-Za-z]|[\u4E00-\u9FA5])+$/;
	if(ulevel==3){

    }
/*	if(!reg.test(UserID)){
		alert("温馨提示：\n会员编号不能为特殊字符，只能是数字");
		document.form1.UserID.focus();
		return false;
	}*/
// 	if(!reg1.test(UserName)){
// 		alert("温馨提示：\n会员姓名不能为特殊字符，只能是字母数字");
// 		document.form1.UserName.focus();
// 		return false;
// 	}
    if(UserID.length == 0|| UserID.length != 11){
        alert("温馨提示:\n请正确输入手机号.");
        document.form1.UserID.focus();
        return false;
    }else{
        var myreg=/^[1][3,4,5,7,8,9][0-9]{9}$/;
        if (!myreg.test(UserID)) {
            alert("温馨提示:\n请正确输入手机号.");
            return false;
        }

    }

/* 	if(UserName.length == 0){
 		alert("温馨提示:\n请输入会员姓名.");
 		document.form1.UserName.focus();
 		return false;
 	}*/
 	if(FatherName.length == 0){
 		alert("温馨提示:\n请输入接点人手机号.");
 		document.form1.FatherName.focus();
 		return false;
 	}
/*    if(UserTel.length == 0|| UserTel.length != 11){
        alert("温馨提示:\n请正确输入联系电话.");
        document.form1.UserTel.focus();
        return false;
    }*/
    if(UserAddress.length == 0){
        alert("温馨提示:\n请输入详细地址.");
        document.form1.UserAddress.focus();
        return false;
    }
    if(UserCard.length == 0){
        alert("温馨提示:\n请输入身份证号码.");
        document.form1.UserCard.focus();
        return false;
    }
    if(rName.length == 0){
        alert("温馨提示:\n请输入推荐人手机号.");
        document.form1.rName.focus();
        return false;
    }
// 	if(county.value <=0){
// 		alert("温馨提示：\n请选择您所属的地区");
// 		county.focus();
// 		return false;
// 	}
// 	if(bdName.length == 0){
// 		alert("温馨提示:\n请输入服务中心编号.");
// 		document.form1.bdName.focus();
// 		return false;
// 	}

// 	if(FatherName.length == 0){
// 		alert("温馨提示:\n请输入接点人编号.");
// 		document.form1.FatherName.focus();
// 		return false;
// 	}
// 	if(UserID.length == 0){
// 		alert("温馨提示:\n请输入会员编号.");
// 		document.form1.UserID.focus();
// 		return false;
// 	}
// 	if(NickName.length == 0){
// 		alert("温馨提示:\n请输入会员编号.");
// 		document.form1.NickName.focus();
// 		return false;
// 	}
// 	if(password1.length == 0){
// 		alert("温馨提示:\n请输入一级密码.");
// 		document.form1.password1.focus();
// 		return false;
// 	}
// 	if(password1.length <= 5){
// 		alert("温馨提示:\n密码小于6位.");
// 		document.form1.password1.focus();
// 		return false;
// 	}
// 	if(password12.length == 0){
// 		alert("温馨提示:\n请确认一级密码.");
// 		document.form1.password12.focus();
// 		return false;
// 	}
// 	if(password12.length <= 5){
// 		alert("温馨提示:\n密码小于6位.");
// 		document.form1.password12.focus();
// 		return false;
// 	}
// 	if(password12 != password1){
// 		alert("温馨提示:\n一级密码输入不一致.");
// 		document.form1.password12.focus();
// 		return false;
// 	}
// 	if(password2.length == 0){
// 		alert("温馨提示:\n请输入二级密码.");
// 		document.form1.password2.focus();
// 		return false;
// 	}
// 	if(password2.length <= 5){
// 		alert("温馨提示:\n密码小于6位.");
// 		document.form1.password2.focus();
// 		return false;
// 	}
// 	if(password22.length == 0){
// 		alert("温馨提示:\n请确认二级密码.");
// 		document.form1.password22.focus();
// 		return false;
// 	}
// 	if(password22.length <= 5){
// 		alert("温馨提示:\n密码小于6位.");
// 		document.form1.password22.focus();
// 		return false;
// 	}
// 	if(password22 != password2){
// 		alert("温馨提示:\n二级密码输入不一致.");
// 		document.form1.password22.focus();
// 		return false;
// 	}
// 	if(password3.length == 0){
// 		alert("温馨提示:\n请输入三级密码.");
// 		document.form1.password3.focus();
// 		return false;
// 	}
// 	if(password3.length <= 5){
// 		alert("温馨提示:\n密码小于6位.");
// 		document.form1.password3.focus();
// 		return false;
// 	}
// 	if(password32.length == 0){
// 		alert("温馨提示:\n请确认三级密码.");
// 		document.form1.password32.focus();
// 		return false;
// 	}
// 	if(password32.length <= 5){
// 		alert("温馨提示:\n密码小于6位.");
// 		document.form1.password32.focus();
// 		return false;
// 	}
// 	if(password32 != password3){
// 		alert("温馨提示:\n三级密码输入不一致.");
// 		document.form1.password32.focus();
// 		return false;
// 	}
// 	if(passQuestion.length == 0){
// 		alert("温馨提示:\n请输入密码安全问题.");
// 		document.form1.passQuestion.focus();
// 		return false;
// 	}
// 	if(passAnswer.length == 0){
// 		alert("温馨提示:\n请输入密码安全答案.");
// 		document.form1.passAnswer.focus();
// 		return false;
// 	}


// 	if(UserName.length == 0){
// 		alert("温馨提示:\n请输入会员姓名.");
// 		document.form1.UserName.focus();
// 		return false;
// 	}

// 	if(BankCard.length == 0){
// 		alert("温馨提示:\n请输入开户账号.");
// 		document.form1.BankCard.focus();
// 		return false;
// 	}
// 	if(BankUserName.length == 0){
// 		alert("温馨提示:\n请输入开户姓名.");
// 		document.form1.BankUserName.focus();
// 		return false;
// 	}
	
// 	if(BankAddress.length == 0){
// 		alert("温馨提示:\n请输入开户地址.");
// 		document.form1.BankAddress.focus();
// 		return false;
// 	}
// 	if(useremail.length == 0){
// 		alert("温馨提示:\n请输入电子信箱.");
// 		document.form1.useremail.focus();
// 		return false;
// 	}
// 	if(classification.value == 0){
// 		alert("温馨提示:\n请选择所在省份.");
// 		return false;
// 	}
// 	if(menu.value == 0){
// 		alert("温馨提示:\n请选择所在城市.");
// 		return false;
// 	}
	return true;
}
-->
</script>
<style>
	#test select{
		width:100px;
	}
	#span{color:red;}
  </style>
</head>
<?php
$me=getMemberbyID($_SESSION['ID']);
$_system=new system_class();
$sys=$_system->system_information(1);
?>
<body onLoad="GetNickName();">
<body>
<form id="form1" name="form1"  method="post" action="register2.php" onSubmit="return CheckForm();">
<table  width="100%" height="" cellpadding="3" cellspacing="1" border="0" align="center" class="table1">
	<tr>
    <td colspan="2" align="center" style="color:red;">*为必填项目<iframe name="iframe" id="iframe" width="0" height="0" src="about:blank" style="display:none"></iframe></td>
    </tr>
	<tr>
	  <td width="42%" align="right">服务中心手机号：</td>
	  <td width="58%" align="left"><input name="bdName" type="text" id="bdName" value="<?php echo $_SESSION['isbd']>=2?$_SESSION['nickname']:"admin";?>" maxlength="15" />
&nbsp;<span id="span">(*必填)</span>&nbsp;<label id="bdNamelabel"/>
  <input name="button" type="button" class="button_blue" id="button" onclick='checknickname(1);' value="验  证">
</td>
    </tr>
    <?php
    	$rn=$_GET['rn'];
		if($rn==""){$rn=$_SESSION['nickname'];}
	?>
	<tr>
    <td width="42%" align="right">推荐人手机号：</td>
    <td width="58%" align="left">
      <input name="rName" type="text" id="rName" value="<?php echo $rn?>" maxlength="15"/>
      &nbsp;<span id="span">(*必填)</span>&nbsp;<label id="rnamelable"/>
        <input name="button2" type="button" class="button_blue" id="button2" onclick='checknickname(2);' value="验  证">
      </td>
  </tr>
  <tr >
    <td align="right">接点人手机号：</td>
    <td align="left">
      <input name="FatherName" type="text" id="FatherName"  value="<?=$_GET['nickname']?>" maxlength="15"/>
      &nbsp;<span id="span">(*必填)</span>&nbsp;<label id="FatherNamelabel"/>
        <input name="button3" type="button" class="button_blue" id="button3" onclick='checknickname(3);' value="验  证">
      </td>
  </tr>
    <tr >
     <td align="right">安置区域：</td>
     <td align="left">
       <select name="TreePlace" id="TreePlace">
         <?php if(empty($_GET['tid'])){ ?>
          <option value="1" >左区</option>
          <option value="2" >右区</option>
         <?php }else{?>
           <?php if($_GET['tid']==1){?> <option value="1" >左区</option><?php }?>
           <?php if($_GET['tid']==2){?><option value="2" >右区</option><?php }?>
         <?php } ?>
       </select></td>
    </tr>


<!--  <tr >-->
<!--    <td align="right">安置区域：</td>-->
<!--    <td align="left">-->
<!--      <select name="TreePlace" id="TreePlace">-->
<!--        <option value="1" --><?php //if($_GET['tid']==1){?><!--selected--><?php //}?><!--A区</option>-->
<!--        <option value="2" --><?php //if($_GET['tid']==2){?><!--selected--><?php //}?><!--B区</option>-->
<!--   <!-- <option value="3" --><?php //if($_GET['tid']==3){?><!--selected--><?php //}?><!--C区</option> -->
<!--      </select></td>-->
<!--  </tr>-->
   <tr >
    <td align="right">注册金额：</td>
    <td align="left">
      <select name="uLevel" id="uLevel">
      <?php

		$_ulevel=new ulevel_class();
		$sql="select lvname,ulevel,lsk from ulevel";
		$rs= getAll($sql);
      	foreach($rs as $v){
                    ?>
                    <option value="<?=$v['ulevel']?>"><?=$v['lvname']?>[￥<?=$v['lsk']?>]</option>
        <?php
		}
		?>
      </select></td>
  </tr>

  <tr>
    <td colspan="2" align="center">密码</td>
    </tr>
  <tr>
    <td align="right">一级密码：</td>
    <td align="left"><input name="password1" type="password" id="password1" onBlur="Check('password1');" value="<?=$sys['password1']?>" maxlength="20"/>
      &nbsp;<span id="span">(*必填   默认密码：111111)</span>&nbsp;<label id="password1label"/></td>
  </tr>
  <tr>
    <td align="right">确认一级密码：</td>
    <td align="left"><input name="password12" type="password" id="password12" onBlur="Check('password12');" value="<?=$sys['password1']?>" maxlength="20"/>
      &nbsp;<span id="span">(*必填   默认密码：111111)</span>&nbsp;<label id="password12label"/></td>
  </tr>
  <tr>
    <td align="right">二级密码：</td>
    <td align="left"><input name="password2" type="password" id="password2" onBlur="Check('password2');" value="<?=$sys['password2']?>" maxlength="20"/>
      &nbsp;<span id="span">(*必填  默认密码：222222)</span>&nbsp;<label id="password2label"/></td>
  </tr>
  <tr>
    <td align="right">确认二级密码：</td>
    <td align="left"><input name="password22" type="password" id="password22" onBlur="Check('password22');" value="<?=$sys['password2']?>" maxlength="20"/>
      &nbsp;<span id="span">(*必填   默认密码：222222)</span>&nbsp;<label id="password22label"/></td>
  </tr>
  <tr >
    <td align="right">三级密码：</td>
    <td align="left"><input name="password3" type="password" id="password3" onBlur="Check('password3');" value="<?=$sys['password3']?>" maxlength="20"/>
      &nbsp;<span id="span">(*必填 默认密码：333333)</span>&nbsp;<label id="password3label"/></td>
  </tr>
  <tr>
    <td align="right">确认三级密码：</td>
    <td align="left"><input name="password32" type="password" id="password32" onBlur="Check('password32');" value="<?=$sys['password3']?>" maxlength="20"/>
      &nbsp;<span id="span">(*必填 默认密码：333333)</span>&nbsp;<label id="password32label"/></td>
  </tr>
  <tr style="display:none">
    <td align="right">密码安全问题：</td>
    <td align="left"><input name="passQuestion" type="text" id="passQuestion" onBlur="Check('passQuestion');" value="123" maxlength="50"/>
      &nbsp;<span id="span">(*必填)</span>&nbsp;<label id="passQuestionlabel"/></td>
  </tr>
  <tr style="display:none">
    <td align="right">密码安全答案：</td>
    <td align="left"><input name="passAnswer" type="text" id="passAnswer" onBlur="Check('passAnswer');" value="123" maxlength="50"/>
      &nbsp;<span id="span">(*必填)</span>&nbsp;<label id="passAnswerlabel"/></td>
  </tr>
  <tr>
    <td colspan="2" align="center">会员资料</td>
    </tr>
  <tr>
    <td align="right">会员手机号：</td>
    <td align="left">
      <input name="UserID" type="text" id="UserID" maxlength="15" value=""/>
      &nbsp;<span id="span">(*必填)</span>&nbsp;
      <label id="FatherNamelabel"/>      
      <input name="button4" type="button" class="button_blue" id="button4" onclick='checknickname(4);' value="验  证"></td>
  </tr>
  <tr style="display:none">
    <td align="right">会员编号：</td>
    <td align="left"><input name="NickName" type="text" id="NickName" onBlur="Check('NickName');" value="无需输入" maxlength="20" />
      &nbsp;<span id="span">(*必填)</span>&nbsp;<label id="NickNamelabel"/></td>
  </tr>
  <tr>
    <td align="right">会员姓名：</td>
    <td align="left"><input name="UserName" type="text" id="UserName" onBlur="Check('UserName');" value="" maxlength="10"/>
      &nbsp;<span id="span">(*必填)</span>&nbsp;<label id="UserNamelabel"/></td>
  </tr>
  <tr >
    <td align="right">身份证号码：</td>
    <td align="left"><input name="UserCard" type="text" id="UserCard"  onblur="Check('UserCard');" value="" maxlength="20" onKeyUp="showBirthday(this)" />
       &nbsp;<span id="span">(*必填)</span>&nbsp;&nbsp;<span id="span"></span>&nbsp;<label id="UserCardlabel"/></td>
  </tr>
  <tr>
    <td align="right">性别：</td>
    <td align="left">男
      <input name="sex" type="radio" id="sex" value="1" checked>
      女
      <label for="radio">
        <input type="radio" name="sex" id="sex" value="0">
      </label></td>
  </tr>
  <tr style="display: none">
    <td align="right">出生日期：</td>
    <td align="left"><label for="select"></label>
      <select name="nian" id="nian">
      <?php for($i=1930;$i<=2030;$i++){?>
        <option value="<?=$i?>"><?=$i?></option>
        <?php }?>
      </select>
      年
      <select name="yue" id="yue">
      <?php for($i=1;$i<=12;$i++){?>
        <option value="<?=$i?>"><?=$i?></option>
        <?php }?>
      </select>
      月
      <select name="ri" id="ri">
      <?php for($i=1;$i<=31;$i++){?>
        <option value="<?=$i?>"><?=$i?></option>
        <?php }?>
      </select>
      日</td>
  </tr>
  <tr style="display: none">
    <td align="right">学历：</td>
    <td align="left">
      <select name="xueli" id="xueli">
        <option value="小学">小学</option>
        <option value="初中">初中</option>
        <option value="高中">高中</option>
        <option value="中专">中专</option>
        <option value="大学">大学</option>
        <option value="本科">本科</option>
      </select>
      </td>
  </tr> 
  <tr >
    <td colspan="2" align="center">联系方式</td>
    </tr>
    <tr style="display:none" >
    <td align="right">所属地区：</td>
    <td align="left">
    <select id="province" name="province">
    	<option value="-1">请选择省份</option>
    	<?php 
    		$sql="select * from province";
    		$rs=getAll($sql);
    		foreach($rs as $v){
    	?>
    	<option value="<?php echo $v['provinceid']?>"><?php echo $v['province']?></option>
    	<?php }?>
    </select>
    <select name="city" id="city">
    	<option value="-1">请选择城市</option>
    </select>
     <select name="county" id="county">
    	<option value="-1">请选择县区</option>
    </select>
    </td>
  </tr>
  <tr>
    <td align="right">收货详细地址：</td>
    <td align="left"><input name="UserAddress" type="text" id="UserAddress" onBlur="Check('UserAddress');" value="" maxlength="50"/>
      &nbsp;<span id="span">(*必填)</span>&nbsp;<label id="UserAddresslabel"/></td>
  </tr>
<!--  <tr >
    <td align="right">联系电话：</td>
    <td align="left"><input name="UserTel" type="text" id="UserTel" onBlur="Check('UserTel');" value="" maxlength="20"/>
      &nbsp;<span id="span"></span>&nbsp;<label id="UserTellabel"/></td>
  </tr>-->
  <tr >
    <td align="right">电子邮箱：</td>
    <td align="left"><input name="useremail" type="text" id="useremail" onBlur="Check('useremail');" value="" maxlength="50"/>
       &nbsp;<span id="span"></span>&nbsp;
       <label id="useremaillabel"/></td>
  </tr>
  <tr>
    <td align="right">微信号：</td>
    <td align="left"><input name="UserQQ" type="text" id="UserQQ"  value="" maxlength="12"/></td>
  </tr> 
  <tr>
    <td colspan="2" align="center">银行账户资料</td>
    </tr>
  <tr>
    <td align="right">开户银行：</td>
    <td align="left">

      <select name="bankname" id="bankname">
        <?php
        $sql="select bankname from bankname";
        $rs= getAll($sql);
        foreach($rs as $v){
          ?>
          <option value="<?=$v['bankname']?>"><?=$v['bankname']?></option>
          <?php
        }
        ?>
      </select><span id="span">*(必选)</span>
  </tr>
  <tr>
    <td align="right">开户帐号：</td>
    <td align="left"><input name="BankCard" type="text" id="BankCard" onBlur="Check('BankCard');" value="" maxlength="20"/>
      &nbsp;<span id="span">*请正确填写，否则不能提款</span>&nbsp;<label id="BankCardlabel"/></td>
  </tr>
  <tr>
    <td align="right">开户姓名：</td>
    <td align="left"><input name="BankUserName" type="text" id="BankUserName" onBlur="Check('BankUserName');" value="" maxlength="20"/>
      &nbsp;<span id="span">*既是开户银行姓名，请正确填写，否则不能提款</span>&nbsp;<label id="BankUserNamelabel"/></td>
  </tr>
  <tr  >
    <td align="right">开户地址：</td>
    <td align="left"><input name="BankAddress" type="text" id="BankAddress" onBlur="Check('BankAddress');" value="" maxlength="50"/>
      &nbsp;<span  id="span">*请正确填写，否则不能提款</span>&nbsp;<label id="BankAddresslabel"/></td>
  </tr>
  <tr style="display:none">
    <td align="right">支付宝账号：</td>
    <td align="left"><input name="zhifubao" type="text" id="zhifubao" value="" maxlength="50"/></td>
  </tr>
  <tr style="display:none">
    <td align="right">财付通帐号：</td>
    <td align="left"><input name="caifutong" type="text" id="caifutong"  value="" maxlength="50"/></td>
  </tr>

  <tr>
    <td colspan="2" align="center">
    <input name="submit" type="submit" class="button_green" value="注  册" id="submit" onClick="javascript:return confirm('您确认注册吗？请确认信息填写完整正确.');">
    </td>
  </tr>
</table>
</form>

</body>
</html>
